
<div class="modal fade" id="matchInsert" tabindex="-1" role="dialog" aria-labelledby="matchInsertLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="matchInsertLabel">录入比赛</h4>
            </div>

            <form id="matchInsertForm" action="" onsubmit="return false;">
                <div class="modal-body">
                    <div class="form">

                        <div class="form-group">
                            <div class="form-group">
                                <label>时间范围</label>
                                {{--<div class="input-group" >--}}
                                    <div class="input-group input-group-sm">
                                        <div class="input-group-addon">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <input type="text" class="form-control" id="insert_begin_time" placeholder="开始时间" name="insert_begin_time" value="">
                                        <span class="input-group-addon" style="border-left: 0; border-right: 0;">-</span>
                                        <input type="text" class="form-control" id="insert_end_time" placeholder="结束时间" name="insert_end_time" value="">
                                    </div>
                                {{--</div>--}}
                            </div>

                        </div>

                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" id="send" class="btn btn-primary">确定</button>
                </div>
            </form>


        </div>
    </div>
</div>
<script>
    $(function () {
        $('#match_insert_btn').on('click',function () {
            $('#matchInsert').modal('show');
        });
        $('#matchInsertForm').on('submit', function () {

            $('#send').attr('disabled', 'disabled');
            $('#send').html('正在录入比赛...');
            $.ajax({
                url: '{{route('admin.match.match_insert')}}',
                data: {
                    _token: LA.token,
                    insert_begin_time: $('#insert_begin_time').val(),
                    insert_end_time: $('#insert_end_time').val(),
                },
                method: 'post',
                success: function (res) {
                    $('#send').html('确定');
                    $('#send').attr('disabled', false);
                    if (res.status === 2000) {
                        $('#matchInsert').modal('hide');
                        $.pjax.reload('#pjax-container');
                        toastr.success(res.msg);
                    } else {
                        toastr.error(res.msg);
                    }
                }
            });
            return false;
        });
        $('#insert_begin_time').datetimepicker({"format":"YYYY-MM-DD","locale":"zh-CN"});
        $('#insert_end_time').datetimepicker({"format":"YYYY-MM-DD","locale":"zh-CN"});

    });
</script>